﻿using Oliving.Edge.Common.HttpRestSharp;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace winformTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            //string questUrl = "https://ke.qq.com/webcourse/index.html?id=2";
            //string dbUrl = "https://ke.qq.com/webcourse/index.html";

            //string a = Regex.Match(questUrl, dbUrl.ToLower())?.Value;
            //if (a == questUrl)
            //{
            //    MessageBox.Show("ds");
            //}


            //Expression<Func<int, int, int, int>> func = (m, n, r) => m * n + 2;
            Func<int, int, int> func = (m, n) => m * n + 2;
            int s = func.Invoke(3, 4);

            //利用Lambda表达式  来声明 表达式目录树
            Expression<Func<int, int, int>> exp2 = (m, n) => m * n + 2;
            //利用Compile编译，可以将表达式目录树转换成委托
            Func<int, int, int> func2 = exp2.Compile();
            int result2 = func2.Invoke(2, 3);
            Console.WriteLine("表达式目录树转换成委托后结果为：{0}", result2);


        }

        private void button1_Click(object sender, EventArgs e)
        {

            Thread thread = new Thread(() =>
            {

                while (true)
                {
                    //    var obj = HttpHelper.GetApi(swhApi, "API/PC/RESET", "code=" + model.TD_WuLiaoCode);
                    string a = HttpHelper.GetApi("http://localhost:8082", "/api/Login/JWTToken3.0", "name=test&pass=test");


                    Thread.Sleep(30);
                }
                //

            });
            thread.IsBackground = true;
            thread.Start();
        }
    }
}
